<?php
class Adm{

	private $id;
	private $nome;
	private $email;
	private $login;
	private $senha;
	
	public function __construct($id = 0,$nome= "" ,$email= "" ,$login= "" ,$senha= "" ){
		$this->id = $id;
		$this->nome = $nome;
		$this->email = $email;
		$this->login = $login;
		$this->senha = $senha;
	}

	public static function construct($array){
		return new Adm( $array['id'], $array['nome'], $array['email'], $array['login'], $array['senha']);
	}

	public function getId(){
		return $this->id;
	}

	public function setId($id=0){
		$this->id=$id;
	}

	public function getNome(){
		return $this->nome;
	}

	public function setNome($nome){
		$this->nome=$nome;
	}

	public function getEmail(){
		return $this->email;
	}

	public function setEmail($email){
		$this->email=$email;
	}

	public function getLogin(){
		return $this->login;
	}

	public function setLogin($login){
		$this->login=$login;
	}

	public function getSenha(){
		return $this->senha;
	}

	public function setSenha($senha){
		$this->senha=$senha;
	}
	
	public function equals($object){
		if($object instanceof Adm){
			if($this->id!=$object->id){
				return false;
			}
			if($this->nome!=$object->nome){
				return false;
			}
			if($this->email!=$object->email){
				return false;
			}
			if($this->login!=$object->login){
				return false;
			}
			if($this->senha!=$object->senha){
				return false;
			}
			return true;
		}
		else{
			return false;
		}
	}
	
	public function toString(){
		return "  [id:" .$this->id. "]  [nome:" .$this->nome. "]  [email:" .$this->email. "]  [login:" .$this->login. "]  [senha:" .$this->senha. "]  " ;
	}
	
	public function toArray(){
		$temp =   (array) $this;
		$array = array();
		foreach ($temp as $k => $v){
			$k = preg_match('/^\x00(?:.*?)\x00(.+)/', $k, $matches) ? $matches[1] : $k;
			$array[$k] = $v;
		}
		return  $array;
	}
}

?>